<?php $this->pageTitle=Yii::app()->name;
$this->breadcrumbs=array(
	'首页'=>array('/'),
);?>
<?php
cs()->registerCssFile(bu().'/css/jquery.tooltip.css');
cs()->registerCoreScript('jquery');
cs()->registerScriptFile(bu().'/javascript/jquery.bgiframe.js');
cs()->registerScriptFile(bu().'/javascript/jquery.dimensions.js');
cs()->registerScriptFile(bu().'/javascript/jquery.tooltip.js');
?>
<div class='span-17 colborder article' id='article'>
<!--新书速递部分开始-->
    <h2 class="fleft">
        新书速递 &nbsp; · · · · · · &nbsp;
        <span class="pl">
            (&nbsp;<a href="<?=$this->createUrl('/book/index',array('t'=>1))?>">查看更多</a>&nbsp;)
        </span>
    </h2>


    <div id="glide1" class="tabs-wrap">
        <ul class="cover-list clearfix" id="cover-list">
        <?php foreach($newbooks as $key=>$book):?>
    <li<?=(($key+1)%5==0)?" class='last'":''?>>
        <div class="detail-frame" id='newbook_frame_<?=$book->id?>' style="display:none;">
            <h2>
                <?=$book->name?>
            </h2>
            <p class="color-gray">
                <?=$book->author?> / <?=date('Y-m',$book->publish_datetime)?> / <?=$book->publish?> / <?=$book->market_price?> / <?=$book->package?>
            </p>
            <p>
                <?=mb_substr($book->extra->book_intro,0,200)?>
            </p>
        </div>

        <?php
        		$imageurl = bu().'/attachment/bookcover/small/'.substr($book->small_pic,strrpos($book->small_pic,'/'));
        ?>
            <?=l(CHtml::image($imageurl,$book->name,array('class'=>'imglink')),'#newbook_frame_'.$book->id,array('onclick'=>"window.location.href='".$book->url."'",'title'=>SiteHelper::YiiSubStr($book->extra->book_intro,0,100),'id'=>'link_'.$book->id))?>
            <div class='book-name'><?=l(SiteHelper::YiiSubStr($book->name,0,8),$book->url,array('title'=>$book->name))?></div>

    </li>
    <?php endforeach;?>
    <div class='clearfix'></div>
        </ul>


    </div>
<!--/新书速递部分结束-->
<hr/>
<!--热门图书部分开始-->
    <h2 class="fleft">
        热门图书 &nbsp; · · · · · · &nbsp;
        <span class="pl">
            (&nbsp;<a href="<?=$this->createUrl('/book/index',array('t'=>2))?>">查看更多</a>&nbsp;)
        </span>
    </h2>


    <div id="glide1" class="tabs-wrap">
        <ul class="cover-list clearfix" id="cover-list">
        <?php foreach($hotbooks as $key=>$book):?>
    <li<?=($key==4)?" class='last'":''?>>
        <div class="detail-frame" id='newbook_frame_<?=$book->book->id?>' style="display:none;">
            <h2>
                <?=$book->book->name?>
            </h2>
            <p class="color-gray">
                <?=$book->book->author?> / <?=date('Y-m',$book->book->publish_datetime)?> / <?=$book->book->publish?> / <?=$book->book->market_price?> / <?=$book->book->package?>
            </p>
            <p>
                <?=mb_substr($book->book->extra->book_intro,0,200)?>
            </p>
        </div>

        <?php
        		$imageurl = bu().'/attachment/bookcover/small/'.substr($book->book->small_pic,strrpos($book->book->small_pic,'/'));
        ?>
           <?=l(CHtml::image($imageurl,$book->book->name,array('class'=>'imglink')),'#newbook_frame_'.$book->book->id,array('onclick'=>"window.location.href='".$book->book->url."'",'title'=>SiteHelper::YiiSubStr($book->book->extra->book_intro,0,100),'id'=>'link_'.$book->book->id))?>
		<div class='book-name'><?=l(SiteHelper::YiiSubStr($book->book->name,0,8),$book->book->url,array('title'=>$book->book->name))?></div>
    </li>
    <?php endforeach;?>
        </ul>


    </div>
<!--/热门图书部分结束-->
</div>
<div class='span-5' id='right-column'>
	<div class='prepend-1 addlibrary'>
		<span><?=CHtml::button('添加周边图书馆',array('onclick'=>"$.ajax({
		url:'".$this->createUrl('/urLibrary/libraryselect')."',
		type:'POST',
		data:'step=1',
		dataType:'html',
		success:function(data){
			if(data==-1){
				alert('请首先登录，再进行其他操作！');
				window.location.href='".$this->createUrl('/user/login')."';
				}
			$('#floatlayout_title').empty().append('第一步：选择你所在的地区');
			$('#floatlayout_content').empty().append(data);
			$('#floatlayout').fadeIn();
			}
	})"))?></span>
	</div><br/><hr/>
<?php
$this->widget('application.components.CollectionList',array('num'=>10));
?>
<hr/>
<?php
$this->widget('application.components.CommentList',array('num'=>10));
?>
</div>
<div class='span-1 last'></div>

<?php
$ck_relation_lib_member = UrMemberLib::model()->find('uid=:uid',array('uid'=>user()->id));
if(isset(user()->id)&&$ck_relation_lib_member===null){
	echo j("$('#floatlayout').fadeIn();");
}
$title = "添加周边图书馆";
$content = "你好!这是你首次登录URSKY图书频道，如果您周边有图书馆，请".l('点击这里开始添加','javascript:;',array('onclick'=>"$.ajax({
	url:'".$this->createUrl('/urLibrary/libraryselect')."',
	type:'POST',
	data:'step=1',
	dataType:'html',
	success:function(data){
		$('#floatlayout_title').empty().append('第一步：选择你所在的地区');
		$('#floatlayout_content').empty().append(data);
		}
	})"));
$this->renderPartial('application.views.layouts.floatlayout',array('title'=>$title,'content'=>$content));
?>

